<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>tab栏切换</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .box {
            width: 1000px;
            height: 525px;
            margin: 20px auto;
            /* border: 1px solid black; */
        }
        .box > ul {
            width: 400px;
            list-style: none;
            height: 50px;
            border: 1px solid black;
            border-bottom: none;
        }
        .box > ul > li {
            width: 100px;
            height: 46px;
            float: left;
            text-align: center;
            line-height: 46px;
            cursor: pointer;
            border-top: 4px solid #ffffff;
        }
        .box > ul > li.active{
            /* border-top: 4px solid red; */
            border-color: red;
        }
        .box > ul > li > span {
            float: right;
            font-size: 12px;
        }
        .box > .products {
            width: 1000px;
            height: 475px;
            border: 1px solid black;
        }
        .box > .products > .item {
            display: none;
        }
        .box > .products > div.current{
            display: block;
        }
    </style>

    <script src="../lib/jquery-3.4.1.js"></script>
    <script>
        $(function(){
            console.log($("li"));
            $("li").mouseenter(function(){
                $(this).addClass("active").siblings("li").removeClass("active");
                // console.log($(this).index());
                // $("div.item").eq($(this).index()).show().siblings().hide();
                $("div.item").eq($(this).index()).addClass("current")
                .siblings().removeClass("current");
            });
        });
    </script>
</head>
<body>
    <div class="box">
        <ul>
            <li class="active">国际大牌 <span>|</span></li>
            <li>国妆大牌 <span>|</span></li>
            <li>清洁用品 <span>|</span></li>
            <li>男士用品</li>
        </ul>
        <div class="products">
            <div class="item current">
                <a href="#"><img src="./imgs/guojidapai.jpg" ></a>
            </div>
            <div class="item">
                <a href="#"><img src="./imgs/guozhuangmingpin.jpg" ></a>
            </div>
            <div class="item">
                <a href="#"><img src="./imgs/qingjieyongpin.jpg"></a>
            </div>
            <div class="item">
                <a href="#"><img src="./imgs/nanshijingpin.jpg" ></a>
            </div>
        </div>
    </div>
</body>
</html>